]> dgit.raspbian.org Git - gnome-shell.git/commit
extensionUtils: Add gettext convenience helpers
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 12 Apr 2020 00:45:55 +0000 (02:45 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 14 Aug 2021 18:45:25 +0000 (18:45 +0000)
commit1deb13e1aaabfd04b2641976a224b6fc2be3b9ec
tree0f1850ca2735a25064910c1d3a0c4a665d23c7c9
parentb9f38f95e37b67ac3aa67f87e301742156ba7ceb
extensionUtils: Add gettext convenience helpers

We have initTranslations() for binding an extension's
gettext domain, but nothing to help with using gettext
from an extension.

Such help would be useful though, as an extension that
calls textdomain() like a normal application would
inadvertently changes the default domain for the whole
gnome-shell process.

Instead, extensions have to use domain-specific versions
of the gettext functions:

```js
const Gettext = imports.gettext.domain('my-extension');
const _ = Gettext.gettext;
```

Make this a bit easier by adding those functions directly
to the extensions object when initTranslations() is called,
then expose helper functions for calling them.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2594

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1941>
js/misc/extensionUtils.js
lint/eslintrc-shell.yml
subprojects/extensions-tool/src/templates/indicator/extension.js